<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Lesson 6. More Keywords.</title>
<link rel="stylesheet" type="text/css" href="css/site.css" />
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="js/AC_RunActiveContent.js" language="javascript"></script>
<script src="js/js_functions.js" language="javascript"></script>
</head>

<body>
	
	<table class="header">
		<tr>
			<td width="80">
				<img src="img/logo-small.png" />
			</td>
			<td width="10">
				<table height="40">
					<tr>
						<td class="leftBorderWhite">&nbsp;</td>
					</tr>
				</table>
			</td>
			<td>
				<table>
					<tr>
						<td><h1>Lesson 6. More Keywords.</h1></td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	
	<div class="main">
		<h2>In this example you will learn about the remaining keywords that apply to FXML</h2>
		<p>We will cover the following keywords:</p>
		<ul>
			<li><a href="#readOnly">readOnly</a></li>
			<li><a href="#reference">reference</a></li>
			<li><a href="#flashvars">flashvars</a></li>
		</ul>
		<br/>
		
		<a name="readOnly"></a><h2><code>readOnly</code></h2>
		<p>
			The <code>readOnly</code> keyword is used to target a property on an object that has "read only" access.
			By default FXML will attempt to assign a value to a property unless you explicitly assign the <code>readOnly</code> attribute to "<code>true</code>". 
		</p>
		
		<table class="main">
			<tr>
				<td>The following is an example on how to use the <code>readOnly</code> keyword.</td>
			</tr>
			<tr>
				<td class="example">
					<h3>FXML:</h3>
					<img src="img/Graphics-XML.png" />
					<div class="right"><a href="examples/Graphics.xml" target="_blank">source</a></div>
				</td>
			</tr>
			<tr>
				<td class="example">
					<h3>FXML Result:</h3>
					<div id="Graphics" class="application">
						<script language="javascript">
							if (AC_FL_RunContent == 0) {
								alert("This page requires AC_RunActiveContent.js.");
							} else {
								AC_FL_RunContent(
									'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
									'src', 'swf/org.fxml.Application',
									'width', '100%',
									'height', '70',
									'quality', 'high',
									'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
									'align', 'middle',
									'play', 'true',
									'loop', 'true',
									'scale', 'noScale',
									'wmode', 'transparent',
									'devicefont', 'false',
									'id', 'Graphics',
									'bgcolor', '#c81b1b',
									'name', 'Graphics',
									'menu', 'true',
									'allowFullScreen', 'false',
									'allowScriptAccess','sameDomain',
									'movie', 'swf/org.fxml.Application',
									'salign', 'lT',
									'flashVars', 'id=fxm/l&configFile=examples/Graphics.xml'
									); //end AC code
							}
						</script>
					</div>
				</td>
			</tr>
		</table>
		
		In the example above we create a <code>flash.display.Sprite</code>, target the <code>graphics</code> property (using the <code>readOnly</code> property) and 
		draw a black rectangle.
		<br/><br/><br/>
		
		<a name="reference"></a><h2><code>reference</code></h2>
		<p>
			The <code>reference</code> keyword is used to retrieve the value of a constant. It can also be used to return the type of complex object.
		</p>
		
		<table class="main">
			<tr>
				<td>The following is an example on how to use the <code>reference</code> keyword.</td>
			</tr>
			<tr>
				<td class="example">
					<h3>FXML:</h3>
					<img src="img/Reference-XML.png" />
					<div class="right"><a href="examples/Reference.xml" target="_blank">source</a></div>
				</td>
			</tr>
			<tr>
				<td class="example">
					<h3>FXML Result:</h3>
					<div id="Reference" class="application">
						<script language="javascript">
							if (AC_FL_RunContent == 0) {
								alert("This page requires AC_RunActiveContent.js.");
							} else {
								AC_FL_RunContent(
									'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
									'src', 'swf/org.fxml.Application',
									'width', '100%',
									'height', '40',
									'quality', 'high',
									'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
									'align', 'middle',
									'play', 'true',
									'loop', 'true',
									'scale', 'noScale',
									'wmode', 'transparent',
									'devicefont', 'false',
									'id', 'Reference',
									'bgcolor', '#c81b1b',
									'name', 'Reference',
									'menu', 'true',
									'allowFullScreen', 'false',
									'allowScriptAccess','sameDomain',
									'movie', 'swf/org.fxml.Application',
									'salign', 'lT',
									'flashVars', 'id=fxm/l&configFile=examples/Reference.xml'
									); //end AC code
							}
						</script>
					</div>
				</td>
			</tr>
		</table>
		
		In the example above we create a <code>flash.text.TextField</code> object and assign the value of <code>Math.PI</code> to the <code>text</code> property.
		<br/><br/><br/>
		
		<a name="flashvars"></a><h2><code>flashvars</code></h2>
		<p>
			The <code>flashvars</code> keyword is used to retrieve the value of a flashvar passed in through the <code>&lt;object&gt;</code> / <code>&lt;embed&gt;</code> tags in the HTML.
		</p>
		
		<table class="main">
			<tr>
				<td>The following is an example on how to use the <code>flashvars</code> keyword.</td>
			</tr>
			<tr>
				<td class="example">
					<img src="img/FlashVarsExample-XML.png" />
					<div class="right"><a href="examples/FlashVarsExample.xml" target="_blank">source</a></div>
				</td>
			</tr>
			<tr>
				<td class="example">
					<h3>FXML Result:</h3>
					<div id="FlashVarsExample" class="application">
						<script language="javascript">
							if (AC_FL_RunContent == 0) {
								alert("This page requires AC_RunActiveContent.js.");
							} else {
								AC_FL_RunContent(
									'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
									'src', 'swf/org.fxml.Application',
									'width', '100%',
									'height', '40',
									'quality', 'high',
									'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
									'align', 'middle',
									'play', 'true',
									'loop', 'true',
									'scale', 'noScale',
									'wmode', 'transparent',
									'devicefont', 'false',
									'id', 'FlashVarsExample',
									'bgcolor', '#c81b1b',
									'name', 'FlashVarsExample',
									'menu', 'true',
									'allowFullScreen', 'false',
									'allowScriptAccess','sameDomain',
									'movie', 'swf/org.fxml.Application',
									'salign', 'lT',
									'flashVars', 'id=fxm/l&configFile=examples/FlashVarsExample.xml'
									); //end AC code
							}
						</script>
					</div>
				</td>
			</tr>
		</table>
		
		In the example above we create a <code>flash.text.TextField</code> object assign the <code>text</code> property to "configFile: " and then call the
		<code>appendText</code> method passing the result of the flash variable "configFile" as the parameter.
						 
		<br/><br/><br/>				
	</div>
	
</body>
</html>
